﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using B10.Models;
using B10.Helpers;

namespace B10.Controllers
{
    public class HelpController : Controller
    {
        IEmailService _emailService;

        public HelpController()
            :this(new EmailService())
        {

        }

        public HelpController(IEmailService emailService)
        {
            _emailService = emailService;
        }

        //
        // GET: /Help/

        public ActionResult Index()
        {
            return View();
        }

        public ActionResult Start()
        {
            return View();
        }

        public ActionResult Earn()
        {
            return View();
        }

        public ActionResult Promote()
        {
            return View();
        }

        public ActionResult StartAdsense()
        {
            return View();
        }

        public ActionResult Faq()
        {
            return View();
        }

        public ActionResult Terms()
        {
            return View();
        }

        public ActionResult Contact()
        {
            return View();
        }

        [HttpPost]
        public ActionResult Contact(ContactModel model)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    _emailService.SendContact(model.Email, model.Body);
                    return View("ContactResult",new InfoItem("Wiadomość została wysłana!"));
                }
                catch
                {
                    return View("ContactResult",
                        new InfoItem("Wystąpił problem z wysyłaniem wiadomośći. Spróbuj ponownie.",
                            true));
                }
            }
            return View(model);
        }


    }
}
